package typejump.objects;

import typejump.engine.Animation;

public class ExplodingSparkles extends AttachableSparkles {
	public ExplodingSparkles(GameObject host, Animation anim) {
		super(host, anim, 0, AttachableSparkles.ATTACH_CENTER);
		setSpawnRate(0);
		addSparkles(100);
		setLifetime(0.5);
		setTimeout(1);
	}
	

	protected Sparklet sparkle() {
		Sparklet sparkle = super.sparkle();
		double dx = sparkle.x - centerX();
		double dy = sparkle.y - centerY();
		double angle = Math.atan2(dy, dx);
		double mag = Math.random() * 150 + 50;
		sparkle.vx = mag * Math.cos(angle);
		sparkle.vy = mag * Math.sin(angle);
		return sparkle;
	}
}
